# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=dhewm3
pkgver=1.5.1_rc1
_realver=1.5.1_PRE1
pkgrel=0
pkgdesc="Doom 3 engine with native 64-bit support, SDL, and OpenAL"
url="https://dhewm3.org/"
arch="x86_64 x86" #disabled for the other architectures due to compiling problems
license="GPL-3.0-only"
depends="curl libjpeg-turbo libvorbis sdl2 zlib libogg libpng libvorbis"
makedepends="openal-soft-dev make cmake sdl2-dev zlib-dev libjpeg-turbo-dev libogg-dev libpng-dev libvorbis-dev"
options="!check" # make check not implemented
source="$pkgname-$_realver.tar.gz::https://github.com/dhewm/dhewm3/archive/$_realver.tar.gz
	fix-musl.patch
	dhewm3.desktop
	dhewm3.png"
builddir="$srcdir/$pkgname-$_realver/neo"

build() {
	cmake CMakeLists.txt \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DD3XP=1 \
	-DDEDICATED=1 .
	make
}

package() {
	make DESTDIR="$pkgdir" libdir="$pkgdir/usr/lib" install
	install -Dm644 "$srcdir"/dhewm3.desktop "$pkgdir/usr/share/applications/dhewm3.desktop"
	install -Dm644 "$srcdir"/dhewm3.png "$pkgdir/usr/share/pixmaps/dhewm3.png"
}

sha512sums="73b2c43e16a82bc1a4fd6646493e7c69049a3c3abaac2206436f10d6180d616ad38c2c3480538e2690654c2cb73ec1be47d312939d64fd92ce03aff7fe64ceba  dhewm3-1.5.1_PRE1.tar.gz
396b1b4fe1889abf14141887e4a490b6069234784fd934ee120c68bf868febf767cf900a59871453ebd3adf62bf74bc7fba2bf5169b4594b6e735e0888930566  fix-musl.patch
377d34c4d9ab21b09a501431e1bf8d123d3655a47499a7664db85168e2f85b73c8792bc958026593299eac57449f813b10047beb302784cc53d096e1cc37efbd  dhewm3.desktop
13f7a50d1f57d35bf582c3d99ff4dea4b18e60827f62aa640b7b43d419a3f4f478b45311d2abacfd2aa2f033c59f5c6253aa4916fc234b41eb6cc70d5eeac17c  dhewm3.png"
